﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Public.Logger
{
    public class Logger
    {
        /// <summary>
        /// 写入Error日志
        /// </summary>
        /// <param name="log"></param>
        public static void Error(string log, Exception ex = null)
        {
            Log4net.Instance.WriteError($"{log} {ex?.Message}");
        }

        public static void Error(Exception ex)
        {
            Log4net.Instance.WriteError(ex?.Message);
        }

        /// <summary>
        /// 写入Debug日志
        /// </summary>
        /// <param name="log"></param>
        public static void Debug(string log, Exception ex = null)
        {
            Log4net.Instance.WriteDebug($"{log} {ex?.Message}");
        }

        /// <summary>
        /// 写入Info日志
        /// </summary>
        /// <param name="log"></param>
        public static void Info(string log, Exception ex = null)
        {
            Log4net.Instance.WriteInfo($"{log} {ex?.Message}");
        }

        /// <summary>
        /// 写入Warn日志
        /// </summary>
        /// <param name="log"></param>
        public static void Warn(string log, Exception ex = null)
        {
            Log4net.Instance.WriteWarn($"{log} {ex?.Message}");
        }
    }
}
